Validate guest-writable fields in try_pop_buffer_into before allocation#1262
Merged
ludfjig merged 1 commit intohyperlight-dev:mainfrom Feb 26, 2026
Merged
Conversation
24dccad to
7d51b11
Compare
The back-pointer and flatbuffer size prefix in the shared output buffer are written by the guest and were used without validation, allowing a malicious guest to trigger a ~4 GB host-side allocation. Add bounds checks on both fields before any heap allocation occurs and return descriptive errors on violation. Add unit and integration tests exercising corrupt size prefixes and back-pointers. Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com>
7d51b11 to
56d40f6
Compare
andreiltd
approved these changes
Feb 26, 2026
syntactically
approved these changes
Feb 26, 2026
Member
syntactically
left a comment
There was a problem hiding this comment.
The arithmetic overflows causing unintentional panics issue I bet is something we have in other places. (I stand by some of the arguments I made earlier about panic-ing being reasonable behaviour in some situations---but it's important that we are directly aware of the panic opportunities and clear on whether they make sense---i.e. we should have a sensible reasoned argument why they ought to be impossible, even in the face of attacker-controlled data). It would be interesting to take a look at e.g. enumerating every cfg path from any exported function to panic (on an opt build, so that a bunch of the easy ones are gone) and see how much work it would be to make an argument either way on each path.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
try_pop_buffer_intoreads two values from guest-writable shared memoryChanges: